DataHandler.DeviceIdentifier

DeviceIdentifier Class

Retrieves a machine-unique board serial number across Windows, Linux, and macOS by executing platform-specific commands.


Methods

GetBoardSerialAsync()

Detects the current OS and invokes the appropriate system command to fetch the motherboard’s serial number.

  • Returns: Task
    • On Windows: runs wmic baseboard get serialnumber.
    • On Linux: reads /sys/class/dmi/id/board_serial via cat.
    • On macOS: uses ioreg -l | awk -F'"' '/IOPlatformSerialNumber/ {print $4}'.
    • On other platforms: returns "Unsupported OS".

RunCommandAsync(string fileName, string arguments)

Helper that executes a shell command and returns its last non-empty output line.

  • Parameters:
    • fileName: The command or executable to run (e.g., wmic, cat, ioreg).
    • arguments: Arguments or flags for the command.
  • Returns: Task — The trimmed last line of standard output, or an error message on failure.